﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>账户余额 - {site.name}</title>
<meta name="keywords" content="{site.seo_keyword}" />
<meta name="description" content="{site.seo_description}" />
<link href="<%templateskin%>/css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="{config.webpath}scripts/artdialog/ui-dialog.css" />
<script type="text/javascript" charset="utf-8" src="{config.webpath}scripts/jquery/jquery-1.11.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="{config.webpath}scripts/artdialog/dialog-plus-min.js"></script>
<script type="text/javascript" charset="utf-8" src="<%templateskin%>/js/common.js"></script>
</head>

<body>
<!--Header-->
<%template src="_header.html"%>
<!--/Header-->

<div class="section clearfix">
  <div class="line30"></div>

  <div class="info-wrap">
    <!--左侧导航-->
    <%template src="_ucenter_nav.html"%>
    <!--/左侧导航-->
    
    <!--右侧内容-->
    <div class="home-box">
      <%if(action=="recharge")%>
      <!--账户充值-->
      <link rel="stylesheet" href="{config.webpath}css/validate.css" />
      <script type="text/javascript" src="{config.webpath}scripts/jquery/jquery.form.min.js"></script>
      <script type="text/javascript" src="{config.webpath}scripts/jquery/Validform_v5.3.2_min.js"></script>
      <script type="text/javascript">
		$(function(){
			//初始化表单
			AjaxInitForm('#rechargeForm', '#btnSubmit', 0);
		});
      </script>
      <div class="u-tab-head">
        <p>
          <a class="selected" href="<%linkurl("useramount","recharge")%>">账户充值</a>
          <a href="<%linkurl("useramount","log")%>">充值记录</a>
          <a href="<%linkurl("useramount","list")%>">收支明细</a>
        </p>
      </div>
      <div class="u-tab-content">
        <div class="title-div">
          <strong>账户充值</strong>
        </div>
        <form id="rechargeForm" name="recharge_form" url="{config.webpath}tools/submit_ajax.ashx?action=user_amount_recharge&site={site.build_path}">
        <div class="form-box">
          <dl>
            <dt>账户余额：</dt>
            <dd>当前账户金额为：<b class="red">￥{userModel.amount}</b> 元</dd>
          </dl>
          <dl>
            <dt>充值金额：</dt>
            <dd>
              <input name="order_amount" id="order_amount" type="text" class="input small" onkeydown="return checkNumber(event);" datatype="n"  nullmsg="请输入金额" sucmsg=" " /> 元
            </dd>
          </dl>
          <dl>
            <dt>支付方式：</dt>
            <dd>
            <%set DataTable payList=get_payment_list(0, "is_lock=0 and type=1 and id>2")%> <!--取得一个DataTable-->
            <%loop dr payList%>
              <%if(dr__loop__id==(payList.Rows.Count))%>
                <label><input name="payment_id" type="radio" value="{dr[id]}" datatype="*" sucmsg=" " /> {dr[title]}</label>
              <%else%>
                <label><input name="payment_id" type="radio" value="{dr[id]}" /> {dr[title]}</label>
              <%/if%>
            <%/loop%>
            </dd>
          </dl>
          <dl>
            <dt></dt>
            <dd><input name="btnSubmit" id="btnSubmit" type="submit" class="btn btn-success" value="确认充值" /></dd>
          </dl>
        </div>
        </form>
      </div>
      <!--/账户充值-->
      
      <%else if(action=="log")%>
      <!--充值记录-->
      <link rel="stylesheet" href="{config.webpath}css/pagination.css" />
      <script type="text/javascript">
	    function ExecPostBack(checkValue) {
			if (arguments.length == 1) {
				ExecDelete('{config.webpath}tools/submit_ajax.ashx?action=user_recharge_delete', checkValue, '#turl');
			}else{
				var valueArr = '';
				$("input[name='checkId']:checked").each(function(i){
					valueArr += $(this).val();
					if(i < $("input[name='checkId']:checked").length - 1){
						valueArr += ","
					}
				});
				ExecDelete('{config.webpath}tools/submit_ajax.ashx?action=user_recharge_delete', valueArr, '#turl');
			}
		}
	  </script>
      <div class="u-tab-head">
        <p>
          <a href="<%linkurl("useramount","recharge")%>">账户充值</a>
          <a class="selected" href="<%linkurl("useramount","log")%>">充值记录</a>
          <a href="<%linkurl("useramount","list")%>">收支明细</a>
        </p>
      </div>
      <div class="u-tab-content">
        <div class="title-div">
          <strong>充值记录</strong>
        </div>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="mtable">
          <%set DataTable rechargeList=get_user_recharge_list(10, page, "user_id="+userModel.id, out totalcount)%> <!--取得一个DataTable-->
          <%set string pagelist=get_page_link(10, page, totalcount, "useramount", action, "__id__")%> <!--取得分页页码列表-->
          <%foreach(DataRow dr in rechargeList.Rows)%>
            <tr>
              <td width="20" align="center">
                <input name="checkId" class="checkall" type="checkbox" value="{dr[id]}" >
              </td>
              <td>{dr[add_time]}</td>
              <td width="140">{dr[recharge_no]}</td>
              <td width="80"><%=get_payment_title({strtoint({dr[payment_id]})})%></td>
              <td width="80">￥{dr[amount]}</td>
              <td width="50">
                <%if({strtoint({dr[status]})}>0)%>
                  已完成
                <%else%>
                  未完成
                <%/if%>
              </td>
              <td width="30"><a onclick="ExecPostBack('{dr[id]}');" href="javascript:;">删除</a></td>
            </tr>
          <%/foreach%>
          <%if(rechargeList.Rows.Count==0)%>
            <tr><td colspan="5" align="center">暂无记录...</td></tr>
          <%/if%>
        </table>
        <div class="page-foot">
          <div class="flickr right">{pagelist}</div><!--放置页码列表-->
          <div class="page-btns">
            <a onclick="checkAll(this);" href="javascript:;">全选</a>
            <span class="pipe">|</span>
            <a onclick="ExecPostBack();" href="javascript:;">删除</a>
          </div>
        </div>
      </div>
      <input id="turl" type="hidden" value="<%linkurl("useramount","log")%>" /><!--存在跳转的URL值-->
      <!--/充值记录-->
      
      <%else if(action=="list")%>
      <!--收支明细-->
      <link rel="stylesheet" href="{config.webpath}css/pagination.css" />
      <script type="text/javascript">
	    function ExecPostBack(checkValue) {
			if (arguments.length == 1) {
				ExecDelete('{config.webpath}tools/submit_ajax.ashx?action=user_amount_delete', checkValue, '#turl');
			}else{
				var valueArr = '';
				$("input[name='checkId']:checked").each(function(i){
					valueArr += $(this).val();
					if(i < $("input[name='checkId']:checked").length - 1){
						valueArr += ","
					}
				});
				ExecDelete('{config.webpath}tools/submit_ajax.ashx?action=user_amount_delete', valueArr, '#turl');
			}
		}
	  </script>
      <div class="u-tab-head">
        <p>
          <a href="<%linkurl("useramount","recharge")%>">账户充值</a>
          <a href="<%linkurl("useramount","log")%>">充值记录</a>
          <a class="selected" href="<%linkurl("useramount","list")%>">收支明细</a>
        </p>
      </div>
      <div class="u-tab-content">
        <div class="title-div">
          <strong>收支明细</strong>
        </div>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="mtable">
          <%set DataTable amountList=get_user_amount_list(10, page, "user_id="+userModel.id, out totalcount)%> <!--取得一个DataTable-->
          <%set string pagelist=get_page_link(10, page, totalcount, "useramount", action, "__id__")%> <!--取得分页页码列表-->
          <%foreach(DataRow dr in amountList.Rows)%>
            <tr>
              <td width="20" align="center">
                <input name="checkId" class="checkall" type="checkbox" value="{dr[id]}" >
              </td>
              <td width="150">{dr[add_time]}</td>
              <td>{dr[remark]}</td>
              <td width="50">
                <%if({strtoint({dr[value]})}>0)%>
                  +{dr[value]}
                <%else%>
                  {dr[value]}
                <%/if%>
              </td>
              <td width="30"><a onclick="ExecPostBack('{dr[id]}');" href="javascript:;">删除</a></td>
            </tr>
          <%/foreach%>
          <%if(amountList.Rows.Count==0)%>
            <tr><td colspan="5" align="center">暂无记录...</td></tr>
          <%/if%>
        </table>
        <div class="page-foot">
          <div class="flickr right">{pagelist}</div><!--放置页码列表-->
          <div class="page-btns">
            <a onclick="checkAll(this);" href="javascript:;">全选</a>
            <span class="pipe">|</span>
            <a onclick="ExecPostBack();" href="javascript:;">删除</a>
          </div>
        </div>
      </div>
      <input id="turl" type="hidden" value="<%linkurl("useramount","list")%>" /><!--存在跳转的URL值-->
      <!--收支明细-->
      <%/if%>
      
    </div>
    <!--/右侧内容-->
  </div>
</div>

<!--Footer-->
<%template src="_footer.html"%>
<!--/Footer-->
</body>
</html>